﻿<div style="margin:10px 0;"></div>
<div title="添加文章" style="width:100%;padding:60px 60px;" class="easyui-panel" align="center">
   
    <form id="ff" class="easyui-form" method="post" data-options="novalidate:true">
        <div style="margin-bottom:20px">
            <input name="uname" data-options="label:'用户名:',required:true" class="easyui-textbox" style="width:100%;max-width:400px;">
        </div>
        <div style="margin-bottom:20px">
            <input name="upwd" data-options="label:'密码:'" class="easyui-textbox" style="width:100%;max-width:400px;">
        </div>
        <div style="margin-bottom:20px">
            <input name="nname" data-options="label:'昵称:'" class="easyui-textbox" style="width:100%;max-width:400px;">
        </div>
        <div style="margin-bottom:20px">
            <input name="mobile" data-options="label:'手机号码:'" value="" class="easyui-textbox" style="width:100%;max-width:400px;">
        </div>
        <div style="margin-bottom:20px">
            <input name="face" type="file" data-options="label:'头像:'" value="" class="easyui-textbox" style="width:100%;max-width:400px;">
        </div>
        <div style="margin-bottom:20px">
            <select name="admin" data-options="label:'是否为管理员:',editable:false,required:true" class="easyui-combobox" style="width:100%;max-width:400px;">
                <option>True</option>
                <option>False</option>
            </select>
        </div>

    </form>
    <div style="text-align:center;padding:5px 0">
        @if (ViewBag.ErrorMessage != null)
        {
            <div style="color:red;">
                @ViewBag.ErrorMessage
            </div>
        }
        <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()" style="width:120px" data-options="iconCls:'icon-save'">存为草稿</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()" style="width:120px" data-options="iconCls:'icon-save'">发布</a>
    </div>
</div>
<script>
    function submitForm(state) {
        $("#ff").form('submit', {
            //表单验证
            onsubmit: function () {
                //处理state字段
                $("[name=state]").val(state);
                //表单验证
                var checksucc = $(this).form('enableValidation').form('validate')
                var checkeditor = UE.getEditor('editor').hasContents();
                return checksucc && checkeditor;
            }
        });
    }
</script>
